package com.zfl.validation;

import com.zfl.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class StateValidation implements ConstraintValidator<State, String> {
    /**
     * @param value
     * @param context
     * @return
     */

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if (value == null) {
            return false;
        }
        if (value.equals("已发布") || value.equals("草稿") || value.isEmpty()) {
            return true;
        }
        return false;
    }
}
